package gnss_plugs

import (
	"bytes"
	"fmt"
	"os"
)

var (
	RINEX_TransVer     string = "D10.RINEX.Ver 1.02"
	RINEX_CopyRight    string = "D10.RINEX"
	TempFilesDirectory string = os.TempDir()
	Warning_Obs_Exists bool   = true
)

type Rinex2XIonosRec struct {
	timeid  string
	igmas31 string
	igmas32 string
	igmas33 string
	igmas34 string
}

/***
 * 按照rinex格式将浮点数格式化成字符串
 *    前面不足补充空格
 */
func FPrintRinexEV(fv float64, digitN int) string {
	str := ""
	v := fmt.Sprintf("%."+fmt.Sprintf("%d", digitN)+"E", fv)
	l := 12 - len(v)
	if l > 0 {
		str += string(bytes.Repeat([]byte(" "), l))
	}
	str += v

	return str
}

/***
 * 按照rinex格式将浮点数格式化成字符串
 *    前面不足补充空格
 */
func FPrintRinexV(fv float64, digitN int, width int) string {
	str := ""
	v := fmt.Sprintf("%."+fmt.Sprintf("%d", digitN)+"f", fv)
	l := width - len(v)
	if l > 0 {
		str += string(bytes.Repeat([]byte(" "), l))
	}
	str += v

	return str
}

/***
 * 按照rinex格式将浮点数格式化成字符串
 *    前面不足补充空格
 */
func FPrintRinexStrV(v string, width int) string {
	l := width - len(v)
	if l > 0 {
		v = string(bytes.Repeat([]byte(" "), l)) + v
	}
	return v
}
